<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<link rel="stylesheet" href="resources/image-value-via-https.css">
</head>
<body>
<iframe></iframe>
<script>
async_test(function(t) {
  window.addEventListener('load', t.step_func(function() {
    if (window.internals) {
      // Check that the image is in the Resource::Cached state.
      assert_true(internals.isLoadingFromMemoryCache(
          'https://localhost:8443/css/resources/abe.png'))
    }

    var iframe = document.querySelector('iframe');

    // This will cause a renderer crash if DCHECKs are enabled and the request
    // for restoring the image has SSL errors and doesn't have the
    // WebURLRequest::RequestContextImage context (crbug.com/630215).
    iframe.src = 'resources/image-value-cached-iframe.html';
    iframe.addEventListener('load', t.step_func(function() {
      t.done();
    }));
  }));
}, 'Test using cached CSS image value resources (see ' +
    'CSSImageValue::restoreCachedResourceIfNeeded)');
</script>
</body>
</html>
